package cn.bdqn.dept.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @Author 徐凤年
 * @Date 2022/3/25 16:45
 * @Version 1.0
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docket1(Environment environment){
        ApiInfo apiInfo = new ApiInfo(
                "车险理赔系统Api",
                "保险管理模块",
                "1.0",
                "urn:tos",
                new Contact("李四", "http://www.baidu.com", "2650037945@qq.com"),
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList());

        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo)
                .groupName("李四")
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.bdqn.dept.summer.api"))
                .paths(PathSelectors.ant("/dept/**"))
                .build();
    }
}
